<?php 
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();
if(isDevMode()) {
   OCP\Util::addStyle('jobposition', 'jobposition');
   OCP\Util::addStyle('company', 'company');
   OCP\Util::addScript('jobposition', 'jobposition');
} else {
   OCP\Util::addStyle('static', 'jobposition');
   OCP\Util::addStyle('static', 'company');
   OCP\Util::addScript('static', 'apps/jobpos.min');
}
$lang = PFactory::getLanguage();
$lang->load("com_jobs", JPATH_SITE, "zh-CN");
OCP\App::setActiveNavigationEntry('jobpos_index');

$item = $_['jobdetails'];
$interviews = json_decode($item->online_interview_requirements);
?>
<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('jobposition/js', 'jobposition.php'));?>"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
   var addsheet_form = jQuery('#uploadsheetform');
   addsheet_form.fileUploadUIX({
      allowDocImageType: true,
      maxNumberOfFiles: 1, 
      keepList: true,
      autoUpload: true, 
      maxFileSize: 4*1024*1024,
      onCompleteAll: function(list) {
         var errors = []; 
         var success = []; 
         jQuery.each(list, function(i, o) {
            var handler = o.slice(-1)[0]; 
            if(handler.response.error && handler.response.error.length > 0) {
               errors[errors.length] = handler.response.name; 
            }
            else
               success[success.length] = handler.response.name;
         });

         if(errors.length > 0 || success.length <= 0)
            return; 

         var add_new_sheet = $('.successuploadfile .uploadfile_title');
         if(add_new_sheet.length){
            add_new_sheet.empty().html('<b>已选试题：</b>新试卷生成中');
            $('#uploadfile').hide();
            $('#uploadfilesuccess').show().position({
               my : 'center center',
               at : 'center top+100',
               of : $('#onlinetestbody')
            });
            $('table td', '#onlinetestbody').removeClass('selected');
            $('#onlinetesthead i').removeClass('havedone').addClass('nothavedone');
         } else {
            $('.uploadfile_title', '#onlinetestbody').empty().html('<div class="successuploadfile"><div class="uploadfile_title"><b>已选试题：</b>新试卷生成中</div> </div>');
            $('#uploadfilesuccess').show().position({
               my : 'center center',
               at : 'center top+100',
               of : $('#onlinetestbody')
            });
         }

      }
  }); 

}); 
</script>
   <div class="hr_inner_navigate clearfix">
      <div class="hr_breadcrumbs">当前位置：<a href="<?php echo OCP\Util::linkToRoute("jobpos_index");?>">职位管理</a> &gt; <?=$item->job_title?></div>
   </div>
   <div id="jobdemands" class="hr_position_set hr_position_set_inner">

      <div class="hr_position_thename yahei" ><?=$item->job_title?> <a href="<?php echo OC_Helper::linkToRoute("resumes_jobpos", array('jobid'=>$item->id, 'title'=>$item->job_title)); ?>" class="songti"><?=$item->num_applied?>人申请<span class="fonddetail songti">查看</span></a></div>

         <?php if($_['adminuser']): ?>
         <div class="hr_editposition">
         	<div class="hr_edittitle">
               <b>招聘设置</b>
               <?php if(!empty($interviews->onlineinterview)): ?>
                  <span class="medium" style="color:#999; margin-left:10px;">招聘功能已启用，我们将邀请应聘者完成应聘流程</span>
               <?php endif; ?>
            </div>
            <div class="hr_settingwrap">
               <?=$_['jobpos_head']?>
               
               <!-- upload components begin -->
                  <div class="set_quence_content">
                     <div class="notbegin yahei large"><i></i>尚无试题，请您生成一份新试题</div>
                     <div class="uploadtestfile">
                        <div class="uploadfiletips">请上传试题文件，我们的客服人员将帮您生成在线试卷。<br/><span>(支持最大4Ｍ的Word,PDF,JPG,PNG格式) </span></div>
                           <div id="uploadsheetform"  class="uploadform upload_imgbtn">
                               <form id="uploadform" class="ile_upload" action="<?php echo OC_Helper::linkToRoute('jobpos_uploadsheet');?>" method="POST" enctype="multipart/form-data">
                                   <input class="inputfile" type="file" name="Filedata"/>
                                   <div class="button">选择或拖拽文件上传</div>
                                 <input type="hidden" name="jobid" value="<?php echo $jobdetails->id ?>" >
                                 <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
                               </form>
                               <table class="files">
                               <tr class="file_upload_template" style="display:none;">
                               <td class="file_upload_progress"><div style="width:130px;"></div></td>
                               <td class="file_upload_cancel" width="60" ><button class="btn">取消</button></td>
                               </tr>
                               </table>
                         </div>
                     </div>
                  </div>
                  
                  <div class="hr_position_top5 hr_uploadfile" id="uploadfilesuccess" style="display:none;">
                     <div class="hr_position_top5inner">
                        <div class="closediv"></div>
                        <div class="uploadfiledilog">
                            <img src="/images/3/up_success.png"/><br/>试卷生成后我们将向您的企业邮箱发送通知。<br/>如您需要更新或删除试卷，请联系客服 <a href="mailto:support@pipahr.com">support@pipahr.com</a>
                        </div>
                     </div>
                  </div>
                  <div class="hr_position_top5 hr_uploadfile" id="uploadfile" style="display:none;">
                     <div class="hr_position_top5inner">
                        <div class="hr_top5uppoint"></div>
                        <div class="closediv"></div>
                        <div class="set_quence_content">
                           <div class="uploadtestfile">
                              <div class="uploadfiletips">请上传试题文件，我们的客服人员将帮您生成在线试卷。<br/><span>(支持最大4Ｍ的Word,PDF,JPG,PNG格式) </span></div>
                                    <div id="uploadsheetform"  class="uploadform upload_imgbtn">
                                        <form id="uploadform" class="ile_upload" action="<?php echo OC_Helper::linkToRoute('jobpos_uploadsheet');?>" method="POST" enctype="multipart/form-data">
                                            <input class="inputfile" type="file" name="Filedata"/>
                                            <div class="button">选择或拖拽文件上传</div>
                                          <input type="hidden" name="jobid" value="<?php echo $jobdetails->id ?>" >
                                          <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
                                        </form>
                                        <table class="files">
                                        <tr class="file_upload_template" style="display:none;">
                                        <td class="file_upload_progress"><div style="width:130px;"></div></td>
                                        <td class="file_upload_cancel" width="60"><button class="btn">取消</button></td>
                                        </tr>
                                        </table>
                                  </div>
                           </div>
                        </div>
                     </div>
                  </div> 
               <!-- upload components end -->
               
            </div>
         </div>
         
      <?php endif; //adminuser ?>
          <?=$_['part_jobdetails']?>
  </div>  
